﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace CoreApp.Web
{
    public class Program
    {
        public static void Main(string[] args)
        {
            ////加载自定义json配置文件
            // var config = new ConfigurationBuilder()
            //     .SetBasePath(Directory.GetCurrentDirectory())
            //     .AddJsonFile("customconfig.json", optional: true, reloadOnChange: true) //读取自定义json配置数据
            //     .Build();

            // CreateWebHostBuilder(args)
            // .UseConfiguration(config)
            // .Build().Run();


            CreateWebHostBuilder(args)
            .ConfigureLogging(logging =>
            {
                logging.ClearProviders();//移除其它已经注册的日志处理程序
            })
            .Build().Run();
        }

        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseStartup<Startup>();
    }
}
